package com.example.securitydemo.domain.dto;

import com.example.securitydemo.util.Constants;
import com.example.securitydemo.validation.annotation.ValidEmail;
import com.example.securitydemo.validation.annotation.ValidPassword;
import com.example.securitydemo.validation.annotation.ValidPasswordMatch;
import lombok.Data;
import lombok.NonNull;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * Created by Guaguaerhao on 2021/4/15 23:43
 */
@Data
@ValidPasswordMatch
public class UserDto implements Serializable {
    @NotNull
    @NotBlank
    @Size(min = 4, max = 50, message = "用户名长度必须在4到50个字符之间")
    private String username;

    @NotNull
    @ValidPassword
    private String password;

    @NotNull
    private String matchingPassword;

    @NotNull
    @ValidEmail
    private String email;

    @NotNull
    @Pattern(regexp = Constants.PATTERN_MOBILE)
    private String mobile;

    @NotNull
    @NotBlank
    @Size(min = 2, max = 30, message = "姓名长度必须在 2 到 30 个字符之间")
    private String name;
}
